home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / LANG / C / LIB / UNIXLIB37B / !UnixLib37 / src / time / c / getitmr < prev    next >
Text File  |  1996-11-09  |  2KB  |  58 lines

  1. /****************************************************************************
  2.  *
  3.  * $Source: /unixb/home/unixlib/source/unixlib37/src/time/c/RCS/getitmr,v $
  4.  * $Date: 1996/10/30 21:59:01 $
  5.  * $Revision: 1.3 $
  6.  * $State: Rel $
  7.  * $Author: unixlib $
  8.  *
  9.  * $Log: getitmr,v $
  10.  * Revision 1.3  1996/10/30 21:59:01  unixlib
  11.  * Massive changes made by Nick Burret and Peter Burwood.
  12.  *
  13.  * Revision 1.2  1996/05/06 09:01:35  unixlib
  14.  * Updates to sources made by Nick Burrett, Peter Burwood and Simon Callan.
  15.  * Saved for 3.7a release.
  16.  *
  17.  * Revision 1.1  1996/04/19 21:35:00  simon
  18.  * Initial revision
  19.  *
  20.  ***************************************************************************/
  21.  
  22. static const char rcs_id[] = "$Id: getitmr,v 1.3 1996/10/30 21:59:01 unixlib Rel $";
  23.  
  24. #include <stddef.h>
  25. #include <errno.h>
  26. #include <sys/time.h>
  27. #include <sys/unix.h>
  28. #include <sys/syslib.h>
  29.  
  30. /* The `getitimer' function stores information about the timer
  31.    specified by 'which' in the structure pointed at by 'value'
  32.  
  33.    The return value and error conditions are the same as for
  34.    `setitimer'.
  35.  
  36.    Set *value to the current setting of timer 'which'.
  37.    Return 0 on success, -1 on errors.  */
  38. int
  39. getitimer (enum __itimer_which which, struct itimerval *value)
  40. {
  41.   /* We can't implement interval timers whilst executing in a task
  42.      window.  */
  43.   if (__taskwindow)
  44.     {
  45.       errno = ENOSYS;
  46.       return -1;
  47.     }
  48.  
  49.   if ((unsigned)which >= __MAX_ITIMERS)
  50.     {
  51.       errno = EINVAL;
  52.       return -1;
  53.     }
  54.   *value = __u->itimers[which];
  55.  
  56.   return 0;
  57. }
  58.